#!/bin/sh

for i in 5 4 3 2 1 0; do [ -e /dev/snd/pcmC${i}D0p ] && export ALSA_CARD=$i; done

echo "ALSA_CARD=\"$ALSA_CARD\"" > /run/libreelec/retroarch.conf
echo "LD_LIBRARY_PATH=\"/usr/lib:/tmp/cores\"" >> /run/libreelec/retroarch.conf
